package cn.zjyj.module.zjyj.dal.mysql.risklevelconf;

import cn.zjyj.framework.common.common.pojo.PageResult;
import cn.zjyj.framework.datasource.mybatis.core.query.LambdaQueryWrapperX;
import cn.zjyj.framework.datasource.mybatis.core.mapper.BaseMapperX;
import cn.zjyj.module.zjyj.dal.dataobject.risklevelconf.RiskLevelConfDO;
import org.apache.ibatis.annotations.Mapper;
import cn.zjyj.module.zjyj.controller.admin.risklevelconf.vo.*;

/**
 * 风险等级配置 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface RiskLevelConfMapper extends BaseMapperX<RiskLevelConfDO> {

    default PageResult<RiskLevelConfDO> selectPage(RiskLevelConfPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RiskLevelConfDO>()
                .betweenIfPresent(RiskLevelConfDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(RiskLevelConfDO::getRiskType, reqVO.getRiskType())
                .eqIfPresent(RiskLevelConfDO::getLowLevelMinValue, reqVO.getLowLevelMinValue())
                .eqIfPresent(RiskLevelConfDO::getLowLevelMaxValue, reqVO.getLowLevelMaxValue())
                .eqIfPresent(RiskLevelConfDO::getGeneralLevelMinValue, reqVO.getGeneralLevelMinValue())
                .eqIfPresent(RiskLevelConfDO::getGeneralLevelMaxValue, reqVO.getGeneralLevelMaxValue())
                .eqIfPresent(RiskLevelConfDO::getLargerLevelMinValue, reqVO.getLargerLevelMinValue())
                .eqIfPresent(RiskLevelConfDO::getLargerLevelMaxValue, reqVO.getLargerLevelMaxValue())
                .eqIfPresent(RiskLevelConfDO::getMajorLevelMinValue, reqVO.getMajorLevelMinValue())
                .eqIfPresent(RiskLevelConfDO::getMajorLevelMaxValue, reqVO.getMajorLevelMaxValue())
                .orderByDesc(RiskLevelConfDO::getId));
    }

}